package com.tianlan.blog.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import io.swagger.annotations.ApiModelProperty;

@Entity
@Table(name ="title")
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
public class Title {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    
    @Column(name = "parent_id")
    private Integer parentId;
    
    @Column(name = "user_id")
    private Integer userId;
    
    @Column(name = "title")
    private String title;
    
    @ApiModelProperty(value = "创建者")
    @Column(name = "creator")
    @CreatedBy
    private Integer creator;
    
    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time")
    @CreatedDate
    private Date createTime;
    
    @ApiModelProperty(value = "更新者")
    @Column(name = "operator")
    @LastModifiedBy
    private Integer operator;
    
    @ApiModelProperty(value = "更新日期")
    @Column(name = "update_time")
    @LastModifiedDate
    private Date updateTime;

    @ApiModelProperty(value = "1:删除 0:不删除")   
    @Column(name = "del_flag")
    private String delFlag;
    
    @Transient
    private List<Title> children = new ArrayList<>();
    
    @Transient
    private List<ContentTitle> conentTitleChildren = new ArrayList<>(); 

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Integer getCreator() {
		return creator;
	}

	public void setCreator(Integer creator) {
		this.creator = creator;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Integer getOperator() {
		return operator;
	}

	public void setOperator(Integer operator) {
		this.operator = operator;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public List<Title> getChildren() {
		return children;
	}

	public void setChildren(List<Title> children) {
		this.children = children;
	}

	public List<ContentTitle> getConentTitleChildren() {
		return conentTitleChildren;
	}

	public void setConentTitleChildren(List<ContentTitle> conentTitleChildren) {
		this.conentTitleChildren = conentTitleChildren;
	}
		
}
